#include "src/misc.h"

using namespace std;
using namespace cv;

RNG rng(1);





int main() {
    // vector<TGPoint> pts;
    // Mat backGround;
    // generateRandomPointSet(10, rng, pts);
    // backGround = Mat(1000, 1000, CV_8UC3, Scalar(240, 240, 240));
    // drawPoints(backGround, Scalar(255, 0, 0), pts);
    // pair<TGPoint, TGPoint> ret;
    // double d = INT32_MAX;
    
    // sort(pts.begin(), pts.end(), [](TGPoint& p1, TGPoint& p2) {
    //     return p1.x < p2.x;
    // });

    // nearestPairWithDivideAndConquer(pts, ret, d);

    // cout << d << endl;
    // circle(backGround, {ret.first.x, ret.first.y}, 3, Scalar(0, 254, 0), 2);
    // imshow("Main", backGround);
    // circle(backGround, {ret.second.x, ret.second.y}, 3, Scalar(0, 254, 0), 2);
    // imshow("Main", backGround);
    // waitKey(0);
    // destroyAllWindows();

    double d1, d2;
    pair<TGPoint, TGPoint>pp1, pp2;
    vector<TGPoint>pts;
    generateRandomPointSet(30, rng, pts);
    
    d1 = nearestPairWithBruteForce(pts, pp1);
    d2 = nearestPairWithDivideAndConquer(pts, pp2);

    printf("BruteForce: %.3f\n", d1);
    printf("Divide: %.3f\n", d2);


    return 0;
}